package com.hot12345.springmvc;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.hot12345.common.spring.SpringAbstractController;
import com.hot12345.common.util.IPUtil;
import com.hot12345.service.ClickServiceImpl;

@Controller
@RequestMapping("/click")
public class ClickController extends SpringAbstractController {

	private final static Log log = LogFactory.getLog(ClickController.class);
	
	
	@RequestMapping(value="/count",method=RequestMethod.GET)
	public void count(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap,
			long id) throws Exception {
		String ip = IPUtil.getUserIP(request);
		ClickServiceImpl.addClickNum(id, ip);
	}
}
